package com.bmp.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.bmp.dao.BugDao;
import com.bmp.model.Bug;
import com.bmp.model.vo.BugVoProModUser;
import com.bmp.service.BugManager;

@Component("bugManager")
public class BugManagerImpl implements BugManager {
	private BugDao bugDao;

	public BugDao getBugDao() {
		return bugDao;
	}

	@Resource
	public void setBugDao(BugDao bugDao) {
		this.bugDao = bugDao;
	}

	public void addBug(Bug b) {
		this.bugDao.insertBug(b);
	}

	public void deleteBugById(int id) {
		this.bugDao.deleteBugById(id);
	}

	public Bug getBugById(int id) {
		return this.bugDao.getBugById(id);
	}

	public void updateBug(Bug b) {
		this.bugDao.updateBug(b);
	}

	public List<BugVoProModUser> getBug(int page, int rows) {
		return this.bugDao.getBug(page, rows);
	}

	public int getTotalPages() {
		return this.bugDao.getTotalPages();
	}

	public List<Bug> getBugByUserId(int userId) {
		return this.bugDao.getBugByUserId(userId);
	}

	public int getBugTotleByUserId(int userId) {
		List<Bug> bugs = this.bugDao.getBugByUserId(userId);
		return bugs.size();
	}

	public List<Bug> getBugByProjectId(int projectId) {
		return this.bugDao.getBugByProjectId(projectId);
	}

	public int getBugTotleByProId(int proId) {
		List<Bug> bugs = this.bugDao.getBugByProjectId(proId);
		return bugs.size();
	}

	public List<Bug> getBugByModId(int modId) {
		return this.bugDao.getBugByModuleId(modId);
	}

	public int getBugTotleByModId(int modId) {
		List<Bug> bugs = this.bugDao.getBugByModuleId(modId);
		return bugs.size();
	}

	public List<Bug> getBugByAppointId(int apointId) {
		return this.bugDao.getBugByAppointId(apointId);
	}

}
